//
//  HWCommentListNoDataCell.swift
//  HWanGame
//
//  Created by 王昌健 on 2023/12/19.
//  Copyright © 2023 94hwan. All rights reserved.
//

import UIKit

class HWCommentListNoDataCell: UITableViewCell {
    var noDataImageView:UIImageView!
    var noDataLabel:UILabel!
    class func cellWithTableView(_ tableView:UITableView) -> (HWCommentListNoDataCell) {
        let reUse:String = "HWCommentListNoDataCell"
        
        var cell = tableView.dequeueReusableCell(withIdentifier: reUse)
        
        if cell == nil {
            cell = HWCommentListNoDataCell.init(style: UITableViewCell.CellStyle.default, reuseIdentifier: reUse)
        }
        
        return cell as! HWCommentListNoDataCell
    }
    
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        initUI()
        initFrame()
    }
    
    func initUI() -> Void {
        selectionStyle = UITableViewCell.SelectionStyle.none
        backgroundColor = UIColor.clear
        
        noDataImageView = UIImageView()
        noDataImageView.image = UIImage(named: "details_dealbg_NOdata")
        contentView.addSubview(noDataImageView)
        
        noDataLabel = HWLabel.createLabel(title: "暂无评论", color: "#888888", font: 14*widthScale)
        contentView.addSubview(noDataLabel)
    }
    
    func initFrame() -> Void {
        noDataImageView.snp.makeConstraints { make in
            make.top.equalToSuperview().priority(.high)
            make.centerX.equalToSuperview()
            make.width.equalTo(200*widthScale)
            make.height.equalTo(noDataImageView.snp.width).multipliedBy(0.64)
        }
        
        noDataLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(noDataImageView.snp.bottom).offset(10*widthScale)
            make.bottom.equalTo(-10*widthScale)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
